<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!doctype html>
<html class="no-js">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>商城</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/amazeui.min.css">
    <link rel="stylesheet" href=${pageContext.request.contextPath}/assets/css/app.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/assets/css/index.css">
    <!--必要样式-->
    <style type="text/css">
        body {
            background-color: #f6f6f6;
        }

        header {
            background-color: #ED6D00;
        }

        .star {
            font-size: 10px;
        }

        .star-light {
            color: #FFBF13;
        }

        .star-grey {
            color: #CDCDCD;
        }

        .merchant {
            background-color: #fff;
            margin-top: 3px;
        }

        .merchant .title {
            font-size: 18px;
            font-weight: bold;
        }

        .merchant .desc {
            font-size: 14px;
            margin-top: -3px;
            display: block;
        }
    </style>
</head>

<body>
<header data-am-widget="header" class="am-header  am-header-fixed">
    <h1 class="am-header-title" style="margin: 0 13%;">
        <form action="" class="am-form am-form-inline" style="padding: 9px;">
            <div class="am-form-group am-form-icon">
                <i class="am-icon-search" style="left: .8em;top: 45%;"></i>
                <input type="text" class="am-form-field" placeholder="店铺名"
                       style="    padding: 5px;border-radius: 100px;padding-left:2.35em !important;">
            </div>


        </form>

    </h1>
    <div class="am-header-right am-header-nav">
        <a href="#left-link" class="" style="color: #fff;">
            搜索
        </a>
    </div>
</header>
<div class="clearpadding am-u-sm-12" style="background-color: #fff;height: 40px;padding:6px;font-size: 18px"
     align="center">
    <span><i class="am-icon-file-text-o" style="margin-right: 5px;"></i>店铺列表</span>
</div>
<div class="am-g" style="margin-top: 5px;" id="orderAll">

    <div class="am-u-sm-12 merchant" v-for="item in items" v-if="!item.isOnline">
        <a :href="'${pageContext.request.contextPath}/clientUserGoods/goToShop?shopId='+item.id">
            <div class="clearpadding am-u-sm-3">
                <img :src="item.shopImage" width="100%" height="80" style="margin: 8px auto;">
            </div>
            <div class="am-u-sm-9">
                <span class="title">{{item.shopName}}</span><br>
                <span><i class="am-icon-star star star-light" v-for="i in item.score_light"></i><i
                        class="am-icon-star star star-grey" v-for="i in 5-item.score_light"></i><span
                        style="margin-left: 5px;">{{item.score}}</span></span><br>
                <span class="desc am-text-truncate">{{item.shopAddress}}</span>
                <span v-if="!item.isOnline" style="font-size: 12px;color:#ccc;">休息中</span>

            </div>
        </a>
    </div>

</div>
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-default " id="">
    <ul class="am-navbar-nav am-cf am-avg-sm-4">
        <li>
            <a href="${pageContext.request.contextPath}/clientHome/index" class="">
                <span class="am-icon-home"></span>
                <span class="am-navbar-label">首页</span>
            </a>
        </li>
        <li class="active">
            <a href="${pageContext.request.contextPath}/clientHome/goShopList" class="">
                <span class="am-icon-shopping-bag"></span>
                <span class="am-navbar-label">商店</span>
            </a>
        </li>
        <li>
            <a href="${pageContext.request.contextPath}/clientHome/goIntegralShop" class="">
                <span class="am-icon-shopping-cart"></span>
                <span class="am-navbar-label">积分商城</span>
            </a>
        </li>
        <li>
            <a href="${pageContext.request.contextPath}/clientHome/userInfo">
                <span class="am-icon-user"></span>
                <span class="am-navbar-label">我的</span>
            </a>
        </li>

    </ul>
</div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="${pageContext.request.contextPath}/assets/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/amazeui.min.js"></script>
<script src="${pageContext.request.contextPath}/assets/js/vue.js"></script>
<script type="text/javascript">
    var shoplist = new Vue({
        el: "#orderAll",
        data: {
            items: []
        }
    });
    $(function () {
        $.ajax({
            type: "get",
            url: '${pageContext.request.contextPath}/clientUserShop/findAll',
            dataType: 'json',
            success: function (data) {
                if (data.success == true && data.code == 200) {
                    $.each(data.obj, function (i, n) {
                        var star_light = Math.floor(n.score);
                        n.score_light = star_light;
                    });
                    shoplist.items = data.obj;
                }
            }

        });
    });
</script>
</body>

</html>
